package com.EthanYankang;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @Author: Ethan Yankang
 * @Program: my-tomcat2
 * @Date: 2024-09-09 14:43
 **/
/*
 * @description tomcat就是servlet的容器，会实现servlet的规范
 * @params
 * @return
 */
@WebServlet(urlPatterns =
        {"/EthanYankang"}
)
public class MyServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println(req.getMethod());
        resp.getOutputStream().write("Ethan YanKang".getBytes());//浏览器中就能真正的执行这里写入的字符，会显示在浏览器上
    }
}
